const util = require('../../../../utils/util')
const windowWidth = wx.getSystemInfoSync().windowWidth
const menuButtonObject = wx.getMenuButtonBoundingClientRect()
const domainName = getApp().globalData.domainName
const parameter = getApp().globalData.parameter
const license_list = getApp().globalData.license_list
const uav_type_list = getApp().globalData.uav_type_list
const uav_level_list = getApp().globalData.uav_level_list
const pilot_rank_list = getApp().globalData.pilot_rank_list

// pages/saler_invitation/saler_invitation.js
Page({
   /**
   * 页面的初始数据
   */
  data: {
    license_list,
    pilot_rank_list,
    uav_type_list,
    uav_level_list,
    menuButtonObject,
    windowWidth,
  },


  back(){
    wx.navigateBack()
  },


  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    this.setData({
      page_data:JSON.parse(decodeURIComponent(options.page_data))
    })
    wx.request({
      url: domainName + '/preview_invitation_init',
      data: {},...parameter,
      success: res => {
        this.setData({
          show_inputPic:res.data.show_inputPic,
        })
      },
    })
  },

  onReady(e){
    let windowHeight = wx.getSystemInfoSync().windowHeight
    this.setData({
      windowHeight,
      belt_count:parseInt(windowHeight/100),
    })
  },

  onHide(e){
  },

  onShow(){

  },


  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function (e) {
    console.log('用户点击右上角分享',e)
    // wx.showShareMenu({
    //   withShareTicket: true
    // }) 
    return {
      title:'民用无人驾驶航空器操控员执照学习系统',
      path:'/pages/students/stu_register/register_index/register_index?page_data=' + decodeURIComponent(JSON.stringify(this.data.page_data)) + '&invalid_time=' + util.daysLaterOrAfter(new Date(),1)
    }
    
  }
})